﻿using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR.Client;

namespace NotificationFeedBackClient
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            Task.Run(async () =>
            {
                var connection = new HubConnectionBuilder()
                    .WithUrl("http://172.16.0.20:7000/notify").Build();
                connection.ServerTimeout = TimeSpan.FromMinutes(60);
                connection.On("Connected", (string message) =>
                {
                    Console.WriteLine("[Connected]" + message);
                });
                connection.On("App.GenerationTask.FeedBack", (string message) =>
                {
                    Console.WriteLine("[App.GenerationTask.FeedBack]" + message);
                });
                connection.Closed += (error) =>
                {
                    Console.WriteLine("[Disconnectd]");
                    return Task.CompletedTask;
                };
                await connection.StartAsync();
            });

            Console.ReadKey();
        }
    }
}